package main

import "fmt"

func main() {
	//ch := make(chan int, 10)
	//ch <- 10
	//fmt.Println("send success")
	ch2 := make(chan int, 3)
	go func() {
		for i := 0; i < 5; i++ {
			ch2 <- i
		}
		close(ch2)
	}()

	for {
		if data, ok := <-ch2; ok {
			fmt.Println(data)
		} else {
			break
		}
	}
	fmt.Println("main end")
}
